import React from 'react'
import {Input,Button} from 'antd'
import UploadImg from '../components/upload'
import GetCode from '../components/sendcode'
class Index extends React.Component {
    constructor(){
        super()
        this.state={
            phoneNum:'',
            Code:'',
        }
    }
    
    changePhone = (e) => {
        this.setState({
            phoneNum:e.target.value
        })
    }
    changeCode = (e) => {
        this.setState({
            Code:e.target.value
        })
    }
    Login = () =>{
        this.axios({
            url:'/Login',
            method:'post',
            data:{
                phone:this.state.phoneNum,
                Code:this.state.Code,
            }
        }).then(data => {
            console.log(data)
        })
    }
   render() {
       return (
           <div>
                <UploadImg></UploadImg>
                <Input onChange={(e) => {this.changePhone(e)}} style={{width: 200}}></Input>
                <br></br>
                <Input onChange={(e) => {this.changeCode(e)}} style={{width: 200}}></Input>
                <GetCode phoneNum={this.state.phoneNum}></GetCode>

                <Button onClick={()=>{this.Login()}}>登录</Button>
           </div>
       )
    }
}
export default Index